﻿using System;
using UnityEngine;
using UnityEditor;

public class AddDataWindow : EditorWindow
{
    System.Type _type;
    static Action _action;

    public void SetGUI<T>(Action action)
    {
        if (null == action)
        {
            return;
        }

        _type = typeof(T);
        _action = action;
    }

    void OnGUI()
    {
        EditorGUILayout.BeginVertical("Box");
        GUIStyle style = new GUIStyle();
        style.fontSize = 15;
        style.normal.textColor = Color.white;
        style.alignment = TextAnchor.MiddleCenter;
        GUILayout.Label("添加 " + _type, style);
        EditorGUILayout.EndVertical();

        if (null == _action)
        {
            return;
        }

        _action();
    }
}